import { typeModel } from "../Model/typeModel.js"

export const addTypeDao = async (typename,color)=>{
    return await typeModel.create({typename,color})
}
export const delTypeDao = async(id) =>{
    return await typeModel.findByIdAndDelete(id);
}
export const updateTypeDao = async (id,obj)=>{
    return await typeModel.findByIdAndUpdate(id,obj)

}
export const findAllTypeDao = async ()=>{
    return await typeModel.find();
}
export const findTypeByPageDao = async (page,size)=>{
    return await typeModel.find().skip((page-1)*size).limit(size)
}
export const getAllCountDao = async ()=>{
    return await typeModel.countDocuments();
}

export const getTypeByIdDao = async (id)=>{
    return await typeModel.findById(id)
}